/*
 * @Author: your name
 * @Date: 2019-11-21 11:27:24
 * @LastEditTime: 2019-12-04 11:44:04
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \testd:\rich-tao\实验室\laboratory\web\avue-cli\src\api\sysSetup\uesr.js
 */
import request from "@/router/axios";
import qs from "qs";
/**
 * @description: 用户列表
 * @param {object}
 * @return:
 */
export const getUserList = (data = {}) =>
  request({
    // url: `${proxyUrl}/sample/v1/pageQuery`,
    url: "/userInfo/v1/pageQueryTwo",
    method: "post",
    data: qs.stringify(data)
  });

// 获取部门下所有用户信息
export const getAllUserList = (data = {}) => request({
  url: '/userInfo/v1/getDepartmentId',
  method: 'post',
  data: qs.stringify(data)
})

/**
 * @description: 部门列表
 * @param {object}
 * @return:
 */
export const getDepartmentList = (data = {}) =>
  request({
    // url: `${proxyUrl}/sample/v1/pageQuery`,
    url: "/department/v1/selectAllDepartment",
    method: "post",
    data: qs.stringify(data)
  });


/**
 * @description: 确认添加用户
 * @param {object}
 * @return:
 */
export const addUser = (data = {}) =>
  request({
    // url: `${proxyUrl}/sample/v1/pageQuery`,
    url: "/userInfo/v1/insert",
    method: "post",
    data: qs.stringify(data)
  });

/**
 * @description: 确认修改用户
 * @param {object}
 * @return:
 */
export const updateUser = (data = {}) =>
  request({
    // url: `${proxyUrl}/sample/v1/pageQuery`,
    url: "/userInfo/v1/update",
    method: "post",
    data: qs.stringify(data)
  });


//角色管理


/**
 * @description: id删除角色列表项
 * @param {object}
 * @return:
 */
export const deleteRolesItem = (data = {}) =>
  request({
    // url: `${proxyUrl}/sample/v1/pageQuery`,
    url: "/role/v1/getById",
    method: "post",
    data: qs.stringify(data)
  });

/**
 * @description: 角色修改item
 * @param {object}
 * @return:
 */
export const updateUserByRoles = (data = {}) =>
  request({
    // url: `${proxyUrl}/sample/v1/pageQuery`,
    url: "/role/v1/update",
    method: "post",
    data: data
  });

/**
 * @description: 添加角色
 * @param {object}
 * @return:
 */
export const addUserByRoles = (data = {}) =>
  request({
    // url: `${proxyUrl}/sample/v1/pageQuery`,
    url: "/role/v1/insert",
    method: "post",
    data: data
  });


/**
 * @description: 角色管理列表
 * @param {object}
 * @return:
 */
export const getUserByRolesList = (data = {}) =>
  request({
    // url: `${proxyUrl}/sample/v1/pageQuery`,
    url: "/role/v1/pageQuery",
    method: "post",
    data: qs.stringify(data)
  });

/**
 * @description: 角色类型
 * @param {object}
 * @return:
 */
export const getUserByRolesType = (data = {}) =>
  request({
    // url: `${proxyUrl}/sample/v1/pageQuery`,
    url: "/role/v1/selectAllRole",
    method: "post",
    data: qs.stringify(data)
  });


//部门管理

/**
 * @description: 部门新增
 * @param {object}
 * @return:
 */
export const addDepartment = (data = {}) =>
  request({
    url: "/department/v1/insert",
    method: "post",
    data: data
  });
/**
 * @description: 部门修改
 * @param {object}
 * @return:
 */
export const updateDepartment = (data = {}) =>
  request({
    url: "/department/v1/update",
    method: "post",
    data: qs.stringify(data)
  });
/**
 * @description: 部门delete
 * @param {object}
 * @return:
 */
export const deleteDepartment = (data = {}) =>
  request({
    url: "/department/v1/getById",
    method: "post",
    data: qs.stringify(data)
  });
/**
 * @description: 获取图片根路径
 * @param {object}
 * @return:
 */
export const findByIdPicture = (data = {}) =>
  request({
    url: "/userInfo/v1/findByIdPicture",
    method: "post",
    data: qs.stringify(data)
  });

  
export const getEquipmentDevice = (data) => request({
  url: '/equipmentDevice/v1/selectAll',
  method: 'post',
  data: qs.stringify(data)
});

export const delDevice = (data) => request({
  url: '/equipmentDevice/v1/delete',
  method: 'post',
  data: qs.stringify(data)
});
export const saveDevice = (data) => request({
  url:data.id?'/equipmentDevice/v1/update':'/equipmentDevice/v1/insert',
  method: 'post',
  data: qs.stringify(data)
});
